package cn.tedu.controller;

import cn.tedu.mapper.AddressMapper;
import cn.tedu.pojo.entiry.Address;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author Justin Parker
 * @Date 2024/8/8 0008 16:32
 * @Version 1.0
 */
@RestController
@RequestMapping("/v1/address")
public class AddressController {

    @Autowired
    private AddressMapper addressMapper;
    @RequestMapping("insertAddress")
    public String insertAddress(Address address) {
        addressMapper.insertAddress(address);
        return "添加成功";
    }

    @RequestMapping("selectAddress")
    public List<Address> selectAddress() {
      return  addressMapper.selectAddress();
    }

    @RequestMapping("deleteAddress")
    public String deleteAddress(Integer id) {
        addressMapper.deleteAddress(id);
        return "删除成功";
    }

    @RequestMapping("updateAddress")
    public String updateAddress(Address address) {
        addressMapper.updateAddress(address);
        return "修改成功";
    }

}
